<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /}
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /}
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /}
{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/skin/default/skin.css" id="skin" /}
{css rel="stylesheet" type="text/css" href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /}
<title>{$list.title|default='学生成绩下载'}</title>
<meta name="keywords" content="{$list.keywords|default='成绩统计,学生'}">
<meta name="description" content="{$list.description|default='这是我们自己缩写的程序'}">
</head>
<body>
<article class="page-container">
	<form action="/chengji/dwChengji" method="POST" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>学校：</label>
			<div class="formControls col-xs-8 col-sm-9 f-l">
				<span class="select-box f-l" style="width:250px;">
				{php} $school = schlist('校级','校级');{/php}
				<select class="select" id="school" name="school" size="1">
					<option value="">--请选择学校--</option>
					{volist name="school" id="vo"}
						<option value="{$vo.id}">{$vo.title}</option>
					{/volist}
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>年级：</label>
			<div class="formControls col-xs-8 col-sm-9 f-l">
				<span class="select-box f-l" style="width:180px;">
				{php}
					$njlist = nianjiList();
				{/php}
				<select onchange="getbanji()" class="select" id="ruxuenian" name="ruxuenian" size="1">
					<option value="">--请选择年级--</option>
					{foreach $njlist as $key=>$vo}
						<option value="{$key}" >{$vo}</option>
					{/foreach}
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>班级：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<dl class="permission-list">
					<dt>
						<label>
							<input type="checkbox" id="all" onclick="selectall(this)">
							全选
						</label>
					</dt>
					<dd id="banji">
					</dd>
				</dl>
			</div>
		</div>
		<input type="hidden" value="{$id}" name="id">
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
<!--_footer 作为公共模版分离出去-->
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.js"}
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"}
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"}
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"}
 <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"}
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/jquery.validate.js"} 
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/validate-methods.js"} 
{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/messages_zh.js"}
<script type="text/javascript">
	// 设置表单验证规则
	var myrules = {
			title:{
				required:true,
				rangelength:[2,25]
			},
			xuenian:{
				required:true,
				rangelength:[1,15]
			},
			category:{
				required:true,
				digits:true
			},
			bfdate:{
				required:true,
				dateISO:true
			},
			enddate:{
				required:true,
				dateISO:true
			},
		};


	// 获取班级列表
	function getbanji()
	{
		// 获取单位id
		var danwei = $('#school').val();
		if(danwei== null || danwei==''){
			$('#school').focus();
			layer.alert('请先选择学校');
			return true;
		}
		$.ajax({
			type: 'POST',
			url: "/banji/mybanji",
			data:{
				school:danwei,
				nianji:$('#ruxuenian').val()
			},
			dataType: 'json',
			success: function(data){
				// 删除原来的班级
				$('#banji').text('');
				// 清除选选
				$('#all').prop('checked',false);
				// 循环写出新班级
				for (var val in data) {
					$('#banji').append('<label><input type="checkbox" class="ml-15 mr-5" value="'+data[val]['id']+'" name="banjiids[]" onclick="selecttop(this)" id='+val+'>'+data[val]['title'])+'</label>';
				}

			},
			error:function(data) {
				layer.alert('获取班级失败');
			},
		});		
	}

function selectall(obj)
	{
		// 定位复选框位置
		var topobj = $(obj).parents('dt').next('dd');
		var inputs = topobj.find('input');

		if($(obj).prop('checked'))
		{
			inputs.prop('checked',true);
		}else{
			inputs.prop('checked',false);
		}
	}

	function selecttop(obj)
	{
		// 定位复选框位置
		var topobj = $(obj).parents('dd').prev('dt');
		var thatinput = topobj.find('input');
		if($(obj).prop('checked'))
		{
			thatinput.prop('checked',true);
		}

	}

</script>
</body>
</html>
